package com.example.demo.mapper;

import com.example.demo.pojo.Category;
import com.example.demo.pojo.User;
import com.example.demo.pojo.request.CategoryRequest;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {

    //查询全部
    List<Category> list();

    //分页
    List<Category> page(CategoryRequest request);

    //添加
    @Insert("insert into library.category (name,remark,update_time,pid) values" +
            " (#{name}, #{remark}, #{updateTime},#{pid})")
    void save(Category user);

    //回写
    @Select("select * from library.category where id=#{id}")
    Category getUser(Integer id);

    //更新
    @Update("update library.category set name=#{name},update_time=#{updateTime} where id=#{id}")
    void getUserByID(Category user);

    //删除
    @Delete("delete from library.category where id=#{id}")
    void delete(Integer id);
}
